<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('礼物记录列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <!--        <div class="col-sm-12 search-collapse">-->
        <!--            <form id="formId">-->
        <!--                <div class="select-list">-->
        <!--                    <ul>-->
        <!--                        <li>-->
        <!--                            <label>openId：</label>-->
        <!--                            <input type="text" name="openid"/>-->
        <!--                        </li>-->
        <!--                        <li>-->
        <!--                            <label>礼物名：</label>-->
        <!--                            <input type="text" name="giftName"/>-->
        <!--                        </li>-->
        <!--                        <li>-->
        <!--                            <label>礼物价格：</label>-->
        <!--                            <input type="text" name="giftGold"/>-->
        <!--                        </li>-->
        <!--                        <li>-->
        <!--                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i-->
        <!--                                    class="fa fa-search"></i>&nbsp;搜索</a>-->
        <!--                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i-->
        <!--                                    class="fa fa-refresh"></i>&nbsp;重置</a>-->
        <!--                        </li>-->
        <!--                    </ul>-->
        <!--                </div>-->
        <!--            </form>-->
        <!--        </div>-->

        <!--        <div class="btn-group-sm" id="toolbar" role="group">-->
        <!--            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="marry:giftRecord:add">-->
        <!--                <i class="fa fa-plus"></i> 添加-->
        <!--            </a>-->
        <!--            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"-->
        <!--               shiro:hasPermission="marry:giftRecord:edit">-->
        <!--                <i class="fa fa-edit"></i> 修改-->
        <!--            </a>-->
        <!--            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"-->
        <!--               shiro:hasPermission="marry:giftRecord:remove">-->
        <!--                <i class="fa fa-remove"></i> 删除-->
        <!--            </a>-->
        <!--            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="marry:giftRecord:export">-->
        <!--                <i class="fa fa-download"></i> 导出-->
        <!--            </a>-->
        <!--        </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('marry:giftRecord:edit')}]];
    var removeFlag = [[${@permission.hasPermi('marry:giftRecord:remove')}]];
    var prefix = ctx + "marry/giftRecord";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "礼物记录",
            columns: [{
                field: 'no',
                title: '序号',
                align: "center",
                width: 40,
                formatter: function (value, row, index) {
                    //获取每页显示的数量
                    var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                    //获取当前是第几页
                    var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                    //返回序号，注意index是从0开始的，所以要加上1
                    return pageSize * (pageNumber - 1) + index + 1;
                }
            },
                {
                    field: 'id',
                    title: '主表ID',
                    visible: false
                },
                {
                    field: 'openid',
                    title: 'openId'
                },
                {
                    field: 'avatarUrl',
                    title: '头像',
                    formatter: function (value, row, index) {
                        if (value == 'avatar_visitor.png') {
                            return "<img class=\"img-circle img-xs\" data-height=\"132px\" data-width=\"132px\" data-target=\"self\" src=\"../img/avatar_visitor.png\"  >";
                        } else {
                            return $.table.imageView(value);
                        }
                    }
                },
                {
                    field: 'nickName',
                    title: '微信名'
                },
                {
                    field: 'giftName',
                    title: '礼物名'
                },
                {
                    field: 'giftGold',
                    title: '礼物价格'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>